package example.step2;

import java.io.FileOutputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;

public class MembersSerial implements Serializable {
    /**
     *
     */
    private static final long serialVersionUID = -5857955996190777817L;
    private byte mByte;
    private short height;
    private int age;
    private long birthday;
    private char gender;
    private boolean isChild;
    private float money;
    private double mDouble;
    private Integer mAge;

    public Integer getmAge() {
        return mAge;
    }

    public void setmAge(Integer mAge) {
        this.mAge = mAge;
    }

    public byte getmByte() {
        return mByte;
    }

    public void setmByte(byte mByte) {
        this.mByte = mByte;
    }

    public short getHeight() {
        return height;
    }

    public void setHeight(short height) {
        this.height = height;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public long getBirthday() {
        return birthday;
    }

    public void setBirthday(long birthday) {
        this.birthday = birthday;
    }

    public char getGender() {
        return gender;
    }

    public void setGender(char gender) {
        this.gender = gender;
    }

    public boolean isChild() {
        return isChild;
    }

    public void setChild(boolean isChild) {
        this.isChild = isChild;
    }

    public float getMoney() {
        return money;
    }

    public void setMoney(float money) {
        this.money = money;
    }

    public double getmDouble() {
        return mDouble;
    }

    public void setmDouble(double mDouble) {
        this.mDouble = mDouble;
    }

    public static void main(String args[]) throws Exception{
        ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(
                "E:\\idea-workspace\\gitee\\demo\\serializable\\src\\main\\java\\objfile\\members.obj"));
        // 创建对象MembersSerial
        MembersSerial member = new MembersSerial();
        member.setAge(27);
        member.setBirthday(1000000000000L);
        member.setChild(false);
        member.setGender('M');
        member.setHeight(Short.parseShort("179"));
        member.setmByte((byte)60);
        member.setmDouble(3.1415926);
        member.setMoney(2000.00f);
        // 设置包装对象
        member.setmAge(Integer.valueOf("27"));
        // 序列化该对象
        out.writeObject(member);
        out.close();

    }
}